<?php
namespace App\Http\Controllers\ApiApp;

use App\DBs\AppVersionDB;
use Illuminate\Http\Request;

class AppVersionController extends BaseController
{
    /**
     * APP版本
     */

    protected $db;

    public function __construct()
    {
        parent::__construct();
        $this->db = new AppVersionDB();
    }

    /**
     * 列表
     */
    public function getIndex()
    {
        $resDb = $this->db->getIndex();
        if ($resDb['code']!=0) {
            return $this->toAppJson(-4);
        }
        $dataArr = $resDb['data'];
        return $this->toAppJson(0,$dataArr);
    }

    /**
     * 获取最新版
     */
    public function getNewOne(Request $request)
    {
        $resDb = $this->db->getNewOne();
        if ($resDb['code']!=0) {
            return $this->toAppJson(-4);
        }
        $dataArr = $resDb['data'];
        return $this->toAppJson(0,$dataArr);
    }
}
